package com.tentative.competition.common.model.schedule.resp;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;
import java.util.Optional;

/**
 * @auther: Smile Huang
 * @date: 2023/6/27 20:40
 * @desc:
 * @version: 2.0
 */
@Data
public class WorksGradeListResp {

    @ApiModelProperty("作品ID")
    private Long worksId;

    @ApiModelProperty("赛程ID")
    private Long scheduleId;

    @ApiModelProperty("队名")
    private String teamName;

    @ApiModelProperty("作品名称")
    private String worksName;

    @ApiModelProperty("获奖评级")
    private String awardName;

    @ApiModelProperty("作品上传时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date worksTime;

    @ApiModelProperty("得分")
    private String score;

    @ApiModelProperty("是否最终得分（0，否 1，是）")
    private Integer finallyScore;

    /**
     * 作品主图
     */
    private String worksImgMainUrl;

    /**
     * 作品主图Id
     */
    private Long worksImgMain;

    private Date createTime;

    @ApiModelProperty("作品编码")
    private String worksEncoding;
    /**
     * 是否首页展示
     */
    private Boolean homeShow;

    /**
     * 是否往届展示
     */
    private Boolean backShow;

    private Integer homeShowVal;

    private Integer sort;

    public Integer getHomeShowVal() {
        return Optional.ofNullable(this.homeShow).orElse(false) ? 1 : 0;
    }
}
